home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d26
/
cattest.arc
/
PROCTOR4.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-07-01
|
6KB
|
230 lines
{$A+,B-,D+,E+,F+,I+,L+,N-,O+,R-,S+,V+}
{$M 65520,0,655360}
PROGRAM Proctor4;
USES overlay,
DOS,timestuf,CRT,UTILITY,Eval3,uuestuff,q1ovr,q2ovr,q3ovr,q4ovr;
{$o q1ovr}
{$o q2ovr}
{$o q3ovr}
{$o q4ovr}
LABEL terminator;
VAR
OvrName : string;
Grade : Integer;
q1done,q2done,q3done,q4done : Boolean;
DirInfo : SearchRec;
Ch : char;
TempFile,
In_TEXT_UUD_File,
GRADEFILE : TEXT;
InFile,
Outfile : FILE OF Byte; {these are the updated files which will
be cloned from the old, and added to
possibly }
linenum: INTEGER;
comment_string : STRING;
student_password,
EOFline,
password,templine,
temp_in_file_name,
temp_out_file_name : STRING;
Line: ARRAY [0..59] OF CHAR;
k1,k : integer;
BEGIN {main program}
ClrScr;
ovrinit('PROCTOR4.OVR');
IF OvrResult=ovrNotFound
THEN
BEGIN
WriteLn('Overlay file not found: ',OvrName,'.');
Pause(1,25,'Aborting');
halt;
END;
IF OvrResult <> ovrOK
THEN
BEGIN
Pause(1,24,'Overlay Manager Error, OvrResult = ');
GoToXY(1,25);
WriteLn(OvrResult);
halt;
END;
BEGIN {decode and begin processing}
ClrScr;
WriteLn('Processing Gradebook, please wait.');
q1done := False;
q2done := False;
q3done := False;
q4done := False;
{carry this code along in case we need it later}
(* FindFirst('*.BK$',Hidden,DirInfo);
WriteLn('Name Size Attr');
WHILE DosError = 0 DO
BEGIN
WITH DirInfo DO
BEGIN
Write(Name:12,Size:8,Attr:4);
IF (Attr AND Hidden) = Hidden
THEN Write(' Hidden ');
WriteLn;
FindNext(DirInfo);
END;
END;
REPEAT
UNTIL KeyPressed;*)
Assign(In_TEXT_UUD_File,'GRADE.BK$');
if not FileExists('GRADE.BK$')
THEN
BEGIN
ClrScr;
WriteLn('Unable to find original grade file.');
WriteLn('Check with your instructor.');
halt;
END;
Assign(TempFile,'OLDGRADE.BK$');
if FileExists('OLDGRADE.BK$')
THEN erase(TempFile);
ReName(In_TEXT_UUD_File,'OLDGRADE.BK$');
IF IOResult <> 0
THEN
BEGIN
ClrScr;
WriteLn('Disk Error(1) has occurred. Please report to instructor.');
halt;
END;
decode;
ASSIGN(GRADEFILE,'NEWGRADE.BK$');
Reset(GRADEFILE);
(* ready to check that student is really who he/she says he/she is *)
READLN(GRADEFILE, password);
FOR k := 1 TO length(password) DO
password[k] := UpCase(password[k]);
REPEAT
ClrScr;
GoToXY(1,1);
WriteLn('Enter your password followed by an ENTER/RETURN. NO BLANKS');
ReadLn(student_password);
FOR k := 1 TO length(student_password) DO
student_password[k] := UpCase(student_password[k]);
UNTIL student_password = password;
REPEAT
READLN(GRADEFILE,password);
IF POS('Q1DONE',password) >0
THEN q1done := True;
IF POS('Q2DONE',password) >0
THEN q2done := True;
IF POS('Q3DONE',password) >0
THEN q3done := True;
IF POS('Q4DONE',password) >0
THEN q4done := True;
UNTIL eof(GRADEFILE);
Close(GRADEFILE);
Assign (GRADEFILE,'NEWGRADE.BK$');
APPEND (GRADEFILE);
WriteLn(GRADEFILE,'Opening grade book');
WriteLn(GRADEFILE,'Grade Book-',Time_Stamp);
(* HERE ARE THE EXAMINATION QUESTIONS *)
IF NOT q1done
THEN
BEGIN
IF q1(Grade)
THEN {} ;
Hide('Q1');
IF Grade = -2
THEN GOTO terminator;
WriteLn(GRADEFILE,'Question 1 grade = ',Grade);
IF Grade = 100
THEN
BEGIN
WriteLn(GRADEFILE,'Q1DONE');
q1done := true;
END;
WriteLn(GRADEFILE,Time_Stamp);
END;
IF NOT q2done
THEN
BEGIN
IF q2(Grade)
THEN {} ;
Hide('Q2');
WriteLn(GRADEFILE,'Question 2 grade = ',Grade);
IF Grade = 100
THEN
BEGIN
WriteLn(GRADEFILE,'Q2DONE');
q2done := true;
END;
WriteLn(GRADEFILE,Time_Stamp);
END;
IF NOT q3done
THEN
BEGIN
IF q3(Grade)
THEN {} ;
Hide('Q3');
WriteLn(GRADEFILE,'Question 3 grade = ',Grade);
IF Grade = 100
THEN
BEGIN
WriteLn(GRADEFILE,'Q3DONE');
q3done := true;
END;
WriteLn(GRADEFILE,Time_Stamp);
END;
IF NOT q4done
THEN
BEGIN
IF q4(Grade)
THEN {} ;
Hide('Q4');
WriteLn(GRADEFILE,'Question 4 grade = ',Grade);
IF Grade = 100
THEN
BEGIN
WriteLn(GRADEFILE,'Q4DONE');
q4done := true;
END;
WriteLn(GRADEFILE,Time_Stamp);
END;
(* HERE IS THE END OF THE EXAMINATION QUESTIONS *)
terminator:
WriteLN(GRADEFILE,'Examination is terminating');
WriteLn(GRADEFILE,Time_Stamp);
Close(GRADEFILE);
encode;
{$I-}
ASSIGN (TempFile, 'NEWGRADE.BK$' ); {temp grade file, to be erased}
REWRITE (Tempfile);
Erase(TempFile);
{$I+}
IF IoResult <> 0
THEN WriteLn('Erase Failed, do it manually.');
{$I-}
ASSIGN (TempFile, 'OLDGRADE.BK$' ); {temp grade file, to be erased}
REWRITE (Tempfile);
Erase(TempFile);
{$I+}
IF IoResult <> 0
THEN WriteLn('Erase Failed, do it manually.');
END; {encode, and proctor1}
ClrScr;
END.